package net.bithappesn.hnqe.traverse;

import java.util.Collection;

import net.bithappens.hnqe.InvalidDataException;
import net.bithappens.hnqe.graph.GraphRelation;
import net.bithappens.hnqe.graph.GraphRelationMember;

public interface IPathValidator {

	/***
	 * Returns the validators id. That id is later used to select the validator.
	 * @return The id
	 */
	public String getValidatorId();
	
	
	/***
	 * A validator may use further parameters that define/refine its search behavior. Each time a validator is used this params are set  
	 * @param params A list of any kind of parameter
	 * @throws InvalidDataException If the parameters format doesn't match the demanded format this exception is thrown
	 */
	public void setParams(Object... params) throws InvalidDataException;
	
	
	
	/***
	 * This method becomes called each step in while traversing the various paths outgoing from the start node. 
	 * Its purpose is it to filter the valid nodes or value nodes that are incidents of the current observed relation 
	 * (this is required since a relation is a hyperlink and thus has various ends).
	 * If a node is valid depends on the implementing validator and the current state of the path. 
	 * @param relations This are all relations outgoing from the current nod within the path.
	 * @param currentPath This is the path so fare gone.
	 * @return The result is a subset of the provided relation incidents, that might be put on to the path
	 * so that its constraints aren't violated. 
	 */
	public Collection<GraphRelationMember> getValidRelationMemberFromSet(Collection<GraphRelationMember> member, GraphPath currentPath);
	
	
	/***
	 * This method becomes called each step in while traversing the various paths outgoing from the start node. 
	 * Its purpose is it to filter the valid relations that are outgoing from the current node. 
	 * If a relation is valid depends on the implementing validator and the current state of the path.
	 * @param relations This are all relations outgoing from the current nod within the path.
	 * @param currentPath This is the path so fare gone.
	 * @return The result is a subset of the provided relations, that might be followed so that the path constraints aren't violated. 
	 */
	public Collection<GraphRelation> getValidRelationsFromSet(Collection<GraphRelation> relations, GraphPath currentPath);
	
	
}
